package org.geekbang.projects.cs.servicebus.filter.impl;

import org.geekbang.projects.cs.entity.staff.CustomerStaff;
import org.geekbang.projects.cs.servicebus.filter.AbstractCustomerStaffFilter;

import java.util.ArrayList;
import java.util.Objects;

/**
 * @description:
 * @author: Kaijun Chen
 * @date: 2023/2/12
 */
public class CustomerStaffSensitiveWordFilter extends AbstractCustomerStaffFilter {

    private static ArrayList<String> sensitiveNames = new ArrayList<>();

    static {
        sensitiveNames.add("1");
        sensitiveNames.add("2");
        sensitiveNames.add("3");
        sensitiveNames.add("4");
    }

    @Override
    public CustomerStaff execute(CustomerStaff customerStaff) {
        if (sensitiveNames.contains(customerStaff.getStaffName())) {
            return null;
        }

        if (getNext() != null) {
            return getNext().execute(customerStaff);
        }

        return customerStaff;
    }
}
